@theme-color: #009ddf;
@background-color: white;
@transition-duration: 0.6s;

*, ::before, ::after {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
}

html {
    box-sizing: border-box;
}

body {
    background-color: @background-color;
    font-size: 16px;
    line-height: 2;
}

.clear-fix::after {
    display: block;
    clear: both;
    content: "";
}

.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    overflow-x: hidden;
}

section {
    float: left;
    width: 50%;
    padding-left: 2%;
    padding-right: 2%;
}

section > * {
    margin-top: 1em;
    margin-bottom: 1em;
}

input, output {
    display: block;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}
input, button {
    padding-left: 0.5em;
    padding-right: 0.5em;
    border-radius: 4px;
    font-size: inherit;
    line-height: inherit;
}
input:focus, button:focus {
    outline: none;
}
input {
    border: 2px solid @theme-color;
    background-color: @background-color;
}
button {
    border: none;
    background-color: @theme-color;
    color: @background-color;
    &:active {
        background-color: darken(@theme-color, 5%);
    }
}
output {
    line-height: 1.5;
}

.wrapper {
    position: relative;
    > .center {
        text-align: center;
    }
    > .left {
        position: absolute;
        top: 0;
        left: 0;
    }
    > .right {
        position: absolute;
        top: 0;
        right: 0;
    }
}

sup, sub {
    font-family: inherit;
    font-size: 12px;
}

.toggle-button {
    position: relative;
    width: 4em;
    width: e("calc(4em - 4px)");
    height: 2em;
    border-width: 2px;
    border-style: solid;
    border-color: greyscale(@theme-color);
    border-radius: 1em;
    background-color: greyscale(@theme-color);
    transition: border-color @transition-duration, background-color @transition-duration;

    &::after {
        position: absolute;
        top: 0;
        left: 0;
        width: 50%;
        height: 100%;
        border-radius: 50%;
        background-color: @background-color;
        transition: left @transition-duration;
        content: "";
    }

    &.on {
        border-color: @theme-color;
        background-color: @theme-color;
    }
    &.on::after {
        left: 50%;
    }
}

@media (max-width: 959px) {
    nav {
        margin-top: 2em;
        margin-bottom: 2em;
    }
    nav > ul {
        width: 90%;
        max-width: 640px;
        margin-left: auto;
        margin-right: auto;
        border: 2px solid @theme-color;
        border-radius: 4px;
        list-style-type: none;
        text-align: center;
    }
    nav > ul > li {
        float: left;
        width: 50%;
        background-color: @background-color;
        color: @theme-color;
        transition: background-color @transition-duration, color @transition-duration;
        &.active {
            background-color: @theme-color;
            color: @background-color;
        }
    }

    main {
        display: block;
        width: 200%;
        transition: transform @transition-duration;
    }
    main[data-current="integer"] {
        transform: translateX(0);
    }
    main[data-current="polynomial"] {
        transform: translateX(-50%);
    }

    section > h2 {
        display: none;
    }
}

@media (min-width: 960px) {
    nav {
        display: none;
    }

    section > h2 {
        margin-top: 2em;
        margin-bottom: 2em;
        text-align: center;
    }
}
